<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use think\Db;

class IndexController extends HomeBaseController{


    public function index(){




        echo date('Y-m-d H:i:s');
        die;

    }


    public function index1()
    {

        $logs=Db::name('ticket_log')
            ->where('status','neq',0)
            ->delete();

//        $logs=Db::name('ticket_log')
//            ->where(['status'=>0])
//            ->where(['new'=>0])
//            ->where('count','gt',0)
//            ->select()->toArray();
//
//        foreach ($logs as $key){
//
//
//            $get=Db::name('ticket_log')
//                ->where(['user_id'=>$key['user_id']])
//                ->where(['ticket_id'=>$key['ticket_id']])
//                ->where(['new'=>1])
//                ->order('id desc')
//                ->find();
//
//
//            if ($get){
//
//                Db::name('ticket_log')
//                    ->where(['user_id'=>$key['user_id']])
//                    ->where(['ticket_id'=>$key['ticket_id']])
//                    ->where(['new'=>1])
//                    ->setInc('count',1);
//
//            }else{
//
//                $n['user_id']=$key['user_id'];
//                $n['count']=1;
//                $n['ticket_id']=$key['ticket_id'];
//                $n['get']=2;
//                $n['new']=1;
//                $n['gettime']=time();
//
//
//                Db::name('ticket_log')
//                    ->data($n)
//                    ->insert();
//            }
//
//
//            Db::name('ticket_log')->where(['id'=>$key['id']])->delete();
//        }
//
//
//        echo "<pre>";
//        print_r($logs);
//        die;


    }




    public function paybackc(){

        $input=file_get_contents("php://input");

        $obj = simplexml_load_string($input, 'SimpleXMLElement', LIBXML_NOCDATA);

        $data = json_decode(json_encode($obj), true);



        Db::name('pay_log')->where(['orderid'=>$data['out_trade_no']])->where(['status'=>0])->find();



    }




}
